﻿using System.IO;

namespace ClieOp
{
    internal class ClieOpReader : StreamReader
    {
        public ClieOpReader(Stream stream) : base(stream)
        {
            MoveToNext();
        }

        public ClieOpReader(string path) : base(path)
        {
            MoveToNext();
        }

        public Record.Record CurrentRecord { get; private set; }
        public int LineNumber { get; private set; }

        public void MoveToNext()
        {
            LineNumber++;
            CurrentRecord = EndOfStream ? null : Record.Record.Parse(ReadLine());
        }
    }
}